package com.example.shop_2212.adapter

import android.widget.ImageView
import com.bumptech.glide.Glide
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.example.base.entity.Menu
import com.example.shop_2212.R
import com.example.shop_2212.utils.GlideUtils

/**
 * 菜单适配器
 */
class MenuAdapter:BaseQuickAdapter<Menu,BaseViewHolder>(R.layout.item_menu) {
    override fun convert(holder: BaseViewHolder, item: Menu) {
        //val imageView = holder.getView<ImageView>(R.id.menu_iv)
        //Glide.with(context).load(item.pic).into(holder.getView(R.id.menu_iv))
        GlideUtils.loadImage(context,item.pic,holder.getView(R.id.menu_iv))
        holder.setText(R.id.menu_tv,item.name)
    }
}

